package cn.com.dhcc.app.pub.core.listener;

import javax.servlet.ServletContextEvent;

import cn.com.dhcc.app.core.CM;
import cn.com.dhcc.app.core.boot.BootParam;
import cn.com.dhcc.app.core.exception.InitException;
import cn.com.dhcc.app.core.listener.AppInitListener;
import cn.com.dhcc.turbo.service.registry.NodeInitService;
import cn.com.dhcc.turbo.service.test.NodeExchTestService;

/**
 * 初始化节点信息
 */
public class NodeInitListener implements AppInitListener {

	@Override
	public void init(ServletContextEvent contextEvent, BootParam bootParam) throws InitException {
		CM.getBean(NodeInitService.class).initNode(contextEvent.getServletContext());
		
		//初始化测试适配器
		NodeExchTestService service=CM.getBean(NodeExchTestService.class);
		if (!service.isInit()) {//初始化测试适配器
			service.init();
		}
	}

	@Override
	public void destroyed(ServletContextEvent contextEvent, BootParam bootParam) throws Exception {
	}

}
